package com.dyna.demo.valid;

import com.dyna.demo.valid.domain.Demo;
import com.dyna.domain.resp.R;
import com.dyna.domain.resp.ResultCode;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * demo模块/Validated 注解的使用
 * @author zhoucaiwang
 * @date 2023/10/28
 */

@RestController
@AllArgsConstructor
public class ValidController {

    @ApiOperation(value = "测试BindingResult")
    @RequestMapping("/valid")
    public R<Object> testValid(@Validated @RequestBody Demo demo) {
        return R.success(ResultCode.SUCCESS);
    }

}
